package net.lab1024.sa.admin.module.business.exam.controller;

import io.swagger.v3.oas.annotations.tags.Tag;
import net.lab1024.sa.admin.module.business.exam.domain.entity.ExamromEntity;
import net.lab1024.sa.admin.module.business.exam.domain.form.add.ExamromAddForm;
import net.lab1024.sa.admin.module.business.exam.domain.form.query.ExamromQueryForm;
import net.lab1024.sa.admin.module.business.exam.domain.form.query.ExamromaQueryForm;
import net.lab1024.sa.admin.module.business.exam.domain.form.update.ExamromUpdateForm;
import net.lab1024.sa.admin.module.business.exam.domain.vo.ExamromStaticVo;
import net.lab1024.sa.admin.module.business.exam.domain.vo.ExamromVO;
import net.lab1024.sa.admin.module.business.exam.service.ExamromService;
import net.lab1024.sa.base.common.domain.PageResult;
import net.lab1024.sa.base.common.domain.ResponseDTO;
import net.lab1024.sa.base.common.domain.ValidateList;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.List;

/**
 * 课程分类 Controller
 *
 * @Author AKITA
 * @Date 2025-06-06 11:33:42
 * @Copyright AKITA
 */

@RestController
@Tag(name = "课程分类")
public class ExamromController {

    @Resource
    private ExamromService examromService;

    @PostMapping("/examrom/queryPage")
    public ResponseDTO<PageResult<ExamromVO>> queryPage(@RequestBody @Valid ExamromQueryForm queryForm) {
        return ResponseDTO.ok(examromService.queryPage(queryForm));
    }


    @PostMapping("/examrom/statis")
    public ResponseDTO<List<ExamromStaticVo>> statis(@RequestBody @Valid ExamromQueryForm queryForm) {
        return examromService.statis(queryForm);
    }

    @PostMapping("/examrom/add")
    public ResponseDTO<Long> add(@RequestBody @Valid ExamromAddForm addForm) {
        return examromService.add(addForm);
    }


    @PostMapping("/examrom/update")
    public ResponseDTO<String> update(@RequestBody @Valid ExamromUpdateForm updateForm) {
        return examromService.update(updateForm);
    }


    @PostMapping("/examrom/batchDelete")
    public ResponseDTO<String> batchDelete(@RequestBody ValidateList<Long> idList) {
        return examromService.batchDelete(idList);
    }

    @GetMapping("/examrom/delete/{docEntry}")
    public ResponseDTO<String> batchDelete(@PathVariable Long docEntry) {
        return examromService.delete(docEntry);
    }

    @GetMapping("/examrom/info/{docEntry}")
    public ResponseDTO<ExamromEntity> info(@PathVariable Long docEntry) {
        return examromService.info(docEntry);
    }

    @GetMapping("/examrom/openAll/{docEntry}")
    public ResponseDTO<ExamromEntity> openAll(@PathVariable Long docEntry) {
        return examromService.openAll(docEntry);
    }

    @PostMapping("/examrom/myList")
    public ResponseDTO<List<ExamromEntity>> myList(@RequestBody ExamromaQueryForm queryForm) {
        return examromService.myList(queryForm);
    }

    @GetMapping("/examrom/myInfo/{docEntry}")
    public ResponseDTO<ExamromEntity> myInfo(@PathVariable Long docEntry) {
        return examromService.myInfo(docEntry);
    }
}
